package SchoolLearning.GitJavaTest;
import java.util.ArrayList;

interface ISignUp {
    public boolean addStudent(int stuType);
}

interface IParams {
    public int getBig();
    public int getMedium();
    public int getSmall();
    public ArrayList<Integer> getPlanSignUp ();
}

public class SchoolSystem implements ISignUp,IParams {
    int big;
    int medium;
    int small;
    int stuType;

    public SchoolSystem(Integer big, Integer medium, Integer small) {
        this.big = big;
        this.medium = medium;
        this.small = small;
    }

    public boolean addStudent(int stuType) {
        boolean found = false;
        if (stuType == 1) {
            this.big -= 1;
            if (this.big >= 0) {
                found = true;
            }
            return found;
        } else if (stuType == 2) {
            this.medium -= 1;
            if (this.medium >= 0) {
                found = true;
            }
            return found;
        } else {
            this.small -= 1;
            if (this.small >= 0) {
                found = true;
            }
            return found;
        }
    }

    public int getBig() {
        return big;
    }

    public int getMedium() {
        return medium;
    }


    public int getSmall() {
        return small;
    }

    public ArrayList<Integer> getPlanSignUp() {
        ArrayList<Integer> stu = new ArrayList<>();
        stu.add(1);
        stu.add(1);
        stu.add(2);
        stu.add(2);
        stu.add(2);
        stu.add(2);
        stu.add(3);
        stu.add(3);
        stu.add(3);
        stu.add(3);
        stu.add(3);
        stu.add(3);
        return stu;
    }

    public static IParams parse() throws Exception {
        return new SchoolSystem(3, 6, 9);
    }

    public static void main(String[] args) throws Exception {
        IParams params = SchoolSystem.parse();
        SchoolSystem sc = new SchoolSystem(params.getBig(), params.getMedium(), params.getSmall());
        ArrayList<Integer> plan = params.getPlanSignUp();
        for (int i = 0; i < plan.size(); i++) {
            sc.addStudent(plan.get(i));
        }
        for (int i = 0; i < plan.size(); i++) {
            System.out.println(sc.addStudent(plan.get(i)));
        }
    }
}
//彭进东对梁宏轩的代码很失望（彭进东已修改）/


